/**
 * 
 */
package com.br.a3q.racha.login.client;

import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * @author Augusto
 * 
 */
public class LoginModule implements EntryPoint {

	private Viewport viewport;
	private LayoutContainer west;
	private LayoutContainer center;
	private LayoutContainer northPanel;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
	 */
	@Override
	public void onModuleLoad() {
		initUI();
		Login dialog = new Login();
		dialog.setClosable(false);
		dialog.show();

	}

	private void initUI() {
		viewport = new Viewport();
		viewport.setLayout(new BorderLayout());
		createNorth();
		createWest();
		createCenter();
		RootPanel.get().add(viewport);
	}

	private void createNorth() {
		northPanel = new LayoutContainer();
		BorderLayoutData data = new BorderLayoutData(LayoutRegion.NORTH, 33);
		data.setMargins(new Margins());
		viewport.add(northPanel, data);
	}

	private void createWest() {
		BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 200,
				150, 350);
		data.setMargins(new Margins(5, 0, 5, 5));
		west = new LayoutContainer();
		viewport.add(west, data);
	}

	private void createCenter() {
		center = new LayoutContainer();
		center.setLayout(new FitLayout());
		BorderLayoutData data = new BorderLayoutData(LayoutRegion.CENTER);
		data.setMargins(new Margins(5, 5, 5, 5));
		viewport.add(center, data);
	}

}
